﻿@model IEnumerable<Web.Areas.Admin.Models.Shop>

@{
    ViewBag.Title = "名店展示";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

@section header{
<style type="text/css">
    .gridColCheck{width:10%;}
    </style>
    <script type="text/javascript">
        $(function () {
            $("input[type='radio']").each(function () {
                $(this).click(function () {
                    $("#btnEdit").attr("href", "/Admin/Shop/Edit/" + $(this).attr("value"));
                    $("#btnDel").attr("href", "/Admin/Shop/Del/" + $(this).attr("value"));
                });
            });
        });
        function cusval() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return true;
            }
        }
        function cusDel() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return confirm('你确定要删除么？');
            }
        }
    </script>
}
<div class="nav">当前位置 :-> 名店推荐</div>
<div class="toolbar">
    @Html.ActionLink("添加","Add", "Shop", new { area="Admin"},null)
    @Html.ActionLink("编辑", "Edit", "Shop", new { area = "Admin" }, new { @id = "btnEdit", onclick = "return cusval()" })
    @Html.ActionLink("删除", "Del", "Shop", new { area = "Admin" }, new { @id = "btnDel", onclick = "return cusDel()" })
    @Html.ActionLink("刷新", "Index", "Shop", new { area = "Admin" }, null)
</div>
<div class="searchbar">
    @using (Html.BeginForm()) {
    @Html.Label("tbxSearchShopID", "门店编号：") @Html.TextBox("tbxSearchShopID", "")
    @Html.Label("tbxSearchShopName", "门店名称：") @Html.TextBox("tbxSearchShopName", "")
    @Html.Label("tbxSearchShopAddress", "门店地址：") @Html.TextBox("tbxSearchShopAddress", "")<br />
    @Html.Label("tbxSearchShopTel", "门店电话：") @Html.TextBox("tbxSearchShopTel", "")
    @Html.Label("tbxSearchShopTypeName", "门店类别：") @Html.TextBox("tbxSearchShopTypeName", "")
    @Html.Label("tbxSearchIsTop", "是否有效：") @Html.TextBox("tbxSearchIsValid", "")<br />
    @Html.Label("tbxSearchIsTop", "首页显示：") @Html.TextBox("tbxSearchIsTop", "")
    <input type="submit" value="搜索" />
    }
</div>
<hr />
@{var grid = new WebGrid(source: Model, defaultSort: "ShopID", rowsPerPage: 10);}

@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
htmlAttributes: new { width = "100%" },
columns: grid.Columns(
grid.Column(format: @<text><input type="radio" name="rdoShop" value="@item.ShopID" /></text>),
            grid.Column("ShopID", "编号"),
            grid.Column("ShopName", "门店名称", format: @<text><span title="@item.ShopName">@Html.FormatStr((string)item.ShopName, 10)</span></text>),
                grid.Column("ShopAddress", "门店地址"),
                    grid.Column("ShopTel", "门店电话"),
                        grid.Column("ShopTypeName", "门店类别"),
                        grid.Column("IsValid", "是否生效"),
                    grid.Column("IsTop","首页显示")
)
)

